const mongoose = require('mongoose');

const winston = require('../utils/winstonLogger.js');

let managerModel = require('../models/Manager.js');

module.exports = {
    queryManager : queryManager
}

function queryManager ($n={},callback){
    managerModel.findOne($n,function(error,docs){
        if(error){
            winston.error(error);
            callback(error,null);
        }
        else{
            if(!docs){
                return callback('unmae or password error!',null);
            }
            console.log("manager name:"+docs.uname);
            docs.password="";
            callback(null,docs);
        }
    });
}
